package org.itboys.seller.service;

import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang.StringUtils;
import org.itboys.admin.dto.AdminUserData;
import org.itboys.commons.utils.cookie.CookieUtils;
import org.itboys.commons.utils.encryption.Digests;
import org.itboys.commons.utils.servlet.ServletContextHolder;
import org.itboys.framework.resource.ResourceHolder;
import org.itboys.mongodb.core.MongoDataSource;
import org.itboys.mongodb.service.BaseService;
import org.itboys.redis.RedisCacheClient;
import org.itboys.seller.constant.CaliforniaSiteConstant;
import org.itboys.seller.constant.SellerConstants;
import org.itboys.seller.constant.SellerCookieConstant;
import org.itboys.seller.constant.SellerSessionConstant;
import org.itboys.seller.entity.ParamSetDB;
import org.itboys.seller.entity.SiteUser;
import org.itboys.seller.utils.SellerSessionHolder;
import org.mongodb.morphia.query.Query;
import org.mongodb.morphia.query.UpdateOperations;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.util.Collections;
import java.util.List;

/**
 * 商家登陆账号
 * @author weisky
 *
 */
@Service
public class ParamSetService extends BaseService<ParamSetDB, Long>{
	
	private static final long serialVersionUID = 1L;

    private static final String SHOP_ID_KEY = "USER_SHOP_ID-";
    private static final int SHOP_ID_EXPIRE = 24 * 3600;

	@Resource(name = "sellerDS")
	private MongoDataSource ds;
	
	@Autowired
	private ResourceHolder resourceHolder;
    @Autowired
    private RedisCacheClient redisCacheClient;

	@Override
	protected MongoDataSource getMongoDataSource() {
		return ds;
	}

	@Override
	protected Class<ParamSetDB> getEntityClass() {
		return ParamSetDB.class;
	}

    public ParamSetDB getParamSet() {
        ParamSetDB setDB = getMongoDataSource().createQuery(ParamSetDB.class).get();
        return setDB == null ? new ParamSetDB() : setDB;
    }
	
}
